<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<title>新增总结</title>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<!--[if lt IE 9]>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/html5.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/respond.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/PIE_IE678.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/lib/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/lib/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/css/sty.css">
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<!--/meta 作为公共模版分离出去-->

<style type="text/css">
	.f-w{font-weight: bold;}
    td{font-size: 14px !important}
    .page-container{margin-bottom: 25px}
    button{margin-left: 20px }
    textarea,.Wdate{background-color: #fbfbfb !important}
    .textarea{height: 70px;width: 90%}
    .wq5{margin-top: 10px;margin-bottom: 10px;}
    .date1{padding-left: 27px !important}
    .textarea1{margin-top: 10px;}
    .a_c{float: right;padding-right: 100px;padding-top: 20px;color: blue}
    .wid1{width: 20%;}
    .btn{width: 80px !important;margin: 15px;}
</style>
</head>


<body>
<div class="page-container">
    <div class="mt-20 wq5" style="padding-bottom: 12px !important;padding-top: 12px !important">
    <form action="" method="post" class="form form-horizontal" id="form-article-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">客户名称：</label>
            <div class="formControls col-xs-6 col-sm-7 date1">
                <input type="text" class="input-text" value="{$clientArr.client_name}" id="client_name" name="client_name" placeholder="请输入客户名称" >
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">店长：</label>
            <div class="formControls col-xs-6 col-sm-7 date1">
                <input type="text" class="input-text" value="{$clientArr.shop_manager}" id="shop_manager" name="shop_manager" placeholder="请输入店长" >
            </div>
        </div>
        <div class="row cl">
            <label class="form-label  col-xs-4 col-sm-3" >店庆时间：</label>
            <div class="formControls col-xs-6 col-sm-7 date1">
                <input type="text" class="input-text Wdate"  <neq name="clientArr.shop_birthday" value="">value="{$clientArr.shop_birthday|date='Y-m-d',###}"</neq>  id="shop_birthday" name="shop_birthday" placeholder="请输入店庆时间" style="width:180px;" onfocus="WdatePicker()">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label  col-xs-4 col-sm-3" >负责人：</label>
            <div class="formControls col-xs-6 col-sm-7 date1">
                <volist name="contactList" id="val">
                    <a href="{:U('Client/contactDetail',array('id'=>$val['id']))}" class="weui_btn weui_btn_default">{$val.realname}</a>
                </volist>
                <span style="color:blue;cursor:pointer;" id="add-fzr" onclick="tjfzr()">添加负责人</span>
                <!-- <a style="text-decoration:none" href="fuzr-add.html"><input type="text" class="input-text" value="" placeholder="" id="" name=""></a><a style="margin-right: -100px;color: blue" href="fuzr-add.html">添加负责人</a> -->
                
            </div>
        </div>
        <div class="row cl">
            <label class="form-label  col-xs-4 col-sm-3" >拜访次数：</label>
            <div class="formControls col-xs-6 col-sm-7 date1">
                <input type="text" class="input-text wid1" value="{$clientArr.visit_year_num}" id="visit_year_num" name="visit_year_num"> 次/年
                <input type="text" class="input-text wid1" value="{$clientArr.visit_quarter_num}" id="visit_quarter_num" name="visit_quarter_num"> 次/季度
                <input type="text" class="input-text wid1" value="{$clientArr.visit_month_num}" id="visit_month_num" name="visit_month_num"> 次/月
            </div>
        </div>
        <div class="row cl">
            <label class="form-label  col-xs-4 col-sm-3" >地址：</label>
            <div class="formControls col-xs-6 col-sm-7 date1">
                <input type="text"  class="input-text" value="{$clientArr.location}" placeholder="点击选择地址"  id="location" name="location" onclick="choice()" placeholder="">
                <input type="text" name="longitude" value="$clientArr.longitude" />
                <input type="text" name="latitude" value="$clientArr.latitude" />
            </div>
        </div>
        <div class="row cl">
            <label class="form-label  col-xs-4 col-sm-3" >备注：</label>
            <div class="formControls col-xs-6 col-sm-7 date1">
                <input type="text"  class="input-text" value="{$clientArr.remark}" placeholder="请输入备注" id="remark" name="remark" placeholder="">
            </div>
        </div>
        <div class="row cl lx-bg">
            <h4 class="form-label  col-xs-4 col-sm-3" >联系方式&nbsp;&nbsp;</h4>
        </div>
        <div class="row cl">
            <label class="form-label  col-xs-4 col-sm-3" >联系电话：</label>
            <div class="formControls col-xs-6 col-sm-7 date1">
                <input type="text"  class="input-text" value="{$clientArr.tel}" placeholder="请输入联系电话" id="tel" name="tel">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label  col-xs-4 col-sm-3" >QQ：</label>
            <div class="formControls col-xs-6 col-sm-7 date1">
                <input type="text"  class="input-text" value="{$clientArr.qq}" placeholder="请输入QQ号码" id="qq" name="qq">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label  col-xs-4 col-sm-3" >微信：</label>
            <div class="formControls col-xs-6 col-sm-7 date1">
                <input type="text"  class="input-text" value="{$clientArr.wechat}" placeholder="请输入微信号" id="wechat" name="wechat">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label  col-xs-4 col-sm-3" >Email：</label>
            <div class="formControls col-xs-6 col-sm-7 date1">
                <input type="text"  class="input-text" value="{$clientArr.email}" placeholder="请输入邮箱地址" id="email" name="email">
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2 text-c">
                <button id="sub" onClick="zjtj()" class="btn btn-primary radius" type="button">添加</button>
                <if condition="$id eq ''">
                    <button onclick="layer_close();" class="btn btn-default radius" type="button">取消</button>
                    <!-- <a class="btn btn-default radius" href='javascript:history.go(-1)'>取消</a> -->
                <else />
                    <button onclick="quxiao()" class="btn btn-default radius" type="button">取消</button>
                    <!-- <a class="btn btn-default radius" href="{:U('Client/quxiao',array('id'=>$id))}">取消</a> -->
                </if>
            </div>
        </div>
    </form>
    </div>
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__PUBLIC__/Admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__/Admin/lib/layer/2.1/layer.js"></script> 
<script type="text/javascript" src="__PUBLIC__/Admin/lib/static/h-ui/js/H-ui.js"></script> 
<script type="text/javascript" src="__PUBLIC__/Admin/lib/static/h-ui.admin/js/H-ui.admin.js"></script> 
<script type="text/javascript" src="__PUBLIC__/Admin/lib/My97DatePicker/WdatePicker.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    // 添加客户
    function zjtj(){
        if( $.trim($('#client_name').val()) == '' ){ 
            layer.msg('请先输入客户名称',{icon:2,time:1000});
        }else{
            $('#sub').attr('onclick','');
            $.ajax({  
                url: "{:U('Client/addCheck',array('id'=>$id))}",   // 如果$id为真，则表示修改此条客户
                type: "POST",  
                data: $('form').serializeArray(), 
                success: function(msg){  
                    //console.log(msg);
                    if(msg['state'] == 200){
                        layer.msg(msg['content'],{icon:1,time:1000});
                        setTimeout('parent.location.href = "{:U('Client/index')}"', 1000);
                    }else{
                        layer.msg(msg['content'],{icon:2,time:1000});
                        $('#sub').attr('onclick','zjtj()');
                    }
                }  
            });
        }   
    }

    // 添加负责人  
    function tjfzr(){
        if( $.trim($('#client_name').val()) == '' ){ 
            layer.msg('请先输入客户名称',{icon:2,time:1000});
        }else{
            $('#add-fzr').attr('onclick','');
            $.ajax({  
                url: "{:U('Client/addCheck',array('id'=>$id))}", 
                type: "POST",  
                data: $('form').serializeArray(), 
                success: function(msg){ 
                    //console.log(msg);
                    if(msg['state'] == 200){
                        layer.msg(msg['content'],{icon:1,time:1000});
                        var url = "{:U('Client/contactAdd',array('cid'=>'clientid'))}";
                        url = url.replace('clientid',msg['id']);
                        window.location.href = url;
                    }else{
                        layer.msg(msg['content'],{icon:2,time:1000});
                        $('#add-fzr').attr('onclick','zjtj()');
                    }
                }  
            });
        }
        
    }

    // 选择地址
    function choice(){
        if( $.trim($('#client_name').val()) == '' ){ 
            layer.msg('请先输入客户名称',{icon:2,time:1000});
        }else{
            $('#location').attr('onclick','');
            $.ajax({  
                url: "{:U('Client/addCheck',array('id'=>$id))}", 
                type: "POST",  
                data: $('form').serializeArray(), 
                success: function(msg){ 
                    //console.log(msg);
                    if(msg['state'] == 200){
                        layer.msg(msg['content'],{icon:1,time:1000});
                        var url = "{:U('Client/choiceAddress',array('id'=>'clientid'))}";
                        url = url.replace('clientid',msg['id']);
                        window.location.href = url;
                    }else{
                        layer.msg(msg['content'],{icon:2,time:1000});
                        $('#location').attr('onclick','zjtj()');
                    }
                }  
            });
        }
    }

    // 取消
    function quxiao(){
        $.ajax({  
            url: "{:U('Client/quxiao',array('id'=>$id))}", 
            success: function(msg){ 
                //console.log(msg);
                if(msg['state'] == 200){
                    layer_close();
                }else{
                    layer.msg(msg['content'],{icon:2,time:1000});
                }
            }  
        });
    }

</script>


</body>
</html>